<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
  </head>
  <body>
    <div id="app">

      <li-count></li-count>
      <div>
        <li-count></li-count>
      </div>
      <li-box></li-box>
      
    </div>

    <script src="../js/vue.js"></script>

    <script>
      //1. 注册局部组件
      const Counter = {
        data() {
          return {
            count:0
          }
        },
        template:`
          <button @click="count++">你点击了{{count}}次</button>
        `
      };


      const Box = {
        components:{
          'cc-count':Counter,
        },
        template:`
          <div style="width: 200px; height: 200px; background-color: red;">
            盒子组件
            <cc-count></cc-count>
          </div>
        `,
      };

      //实例化vue
      const app = Vue.createApp({
        data(){
          return {
            msg:' 哈哈'
          }
        },
        //组件选项
        components:{
          'li-count': Counter,
          'li-box':Box
        }
      }).mount('#app');


            
    </script>
  </body>
</html>